package com.atzzy.ysmall.ysmall_api.UserServiceAllController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.atzzy.ysmall.ysmall_allService.UserService.UserService;
import com.atzzy.ysmall.ysmall_beans.Users;
import com.atzzy.ysmall.ysmall_common.vo.R;
import org.springframework.web.bind.annotation.*;

/**
 * @Author JAVAZeng
 * @Date 2022/2/22 15:12
 * @Version 1.0
 */
@RestController
@RequestMapping("ysmall")
@CrossOrigin
public class UserController {

    @Reference
    private UserService userLogin;

    /**
     *
     * 用户登录接口
     * username password
     * */
    @RequestMapping(value = "ysLogin",method = RequestMethod.GET)
    public R loginCtronller(Users users){
        R resultVo = userLogin.loginTo(users);
        return resultVo;
    }

    /**
     *
     * 用户注册接口
     * phone,username password
     * */
    @RequestMapping(value = "ysRegistry",method = RequestMethod.POST)
    public R registryController(@RequestBody Users users)
    {
        System.out.println(users);
        R resultVo = userLogin.registryTo(users);
        System.out.println(resultVo);
        return resultVo;
    }
}
